import Vue from 'vue';
import { v4 as uuidv4 } from "uuid";
import LineShadowLayerCom from './components/lineShadowLayer.vue'
export default class LineShadow {
  constructor (options) {
    this.map = options.map
    const comVue = Vue.extend(LineShadowLayerCom);
    this.component = new comVue();
    this.componentMap = new Map();
  }
  show() {
    // 组件挂载 添加dom
    let element = document.createElement("div");
    this.component.$mount(element);
    document.getElementById("map").appendChild(this.component.$el);

    // 为组件绑定唯一id 并添加至componentMap统一管理
    const id = uuidv4();
    this.component._componentId = id;
    this.componentMap.set(id, this.component);

    // 组件加载完毕后 进行初始化
    this.component.init(this.map);
  }
}